﻿using System;
using System.IO;
using Agile.Redsys.Repositories;
using Agile.Redsys.Web.Mvc;

namespace Agile.Redsys
{
    /// <summary>
    /// Class Commerce
    /// </summary>
    public class Commerce
    {


        /// <summary>
        /// Gets or sets the merchant code.
        /// </summary>
        /// <value>The merchant code.</value>
        public int MerchantCode { get; set; }
        /// <summary>
        /// Gets or sets the terminal.
        /// </summary>
        /// <value>The terminal.</value>
        public int Terminal { get; set; }
        /// <summary>
        /// Gets or sets the secret code.
        /// </summary>
        /// <value>The secret code.</value>
        public string Secret { get; set; }
        /// <summary>
        /// Gets or sets the name of the merchant.
        /// </summary>
        /// <value>The name of the merchant.</value>
        public string MerchantName { get; set; }
       
        /// <summary>
        /// Gets or sets a value indicating whether enviroment is [test enviroment].
        /// </summary>
        /// <value><c>true</c> if [test enviroment]; otherwise, <c>false</c>.</value>
        public bool TestEnviroment { get; set; }
        /// <summary>
        /// Gets or sets the recurring transactions repository.
        /// </summary>
        /// <value>The recurring transactions repository.</value>
        public IRecurringTransactionRepository RecurringTransactions { get; set; }
        /// <summary>
        /// Gets or sets the successive transactions repository.
        /// </summary>
        /// <value>The successive transactions repository.</value>
        public ISuccessiveTransactionRepository SuccessiveTransactions { get; set; }

        /// <summary>
        /// Occurs when [notification is received].
        /// </summary>
        public event Action<RedsysNotification> NotificationReceived;

        

        /// <summary>
        /// Raises the notification received event.
        /// </summary>
        /// <param name="notification">Received notification.</param>
        internal void RaiseNotificationReceived(RedsysNotification notification)
        {
            if (NotificationReceived != null)
                NotificationReceived(notification);
        }

    
    }
}
